package cz.ctu.guiproject.server.resources;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Logger;

public class FileLoader {
	
	private static final Logger logger = Logger.getLogger(FileLoader.class.getName());
	
	public static String loadTextFile(String filename) {
		final StringBuilder sb = new StringBuilder();
		// get file
		try (BufferedReader br = new BufferedReader(new FileReader(filename))) {
			String line;
			while ((line = br.readLine()) != null) {
				sb.append(line);
			}
		} catch (IOException e) {
			logger.severe(e.getMessage());
		}
		return sb.toString();
	}
}
